/*
 * IndexBuffer.cpp
 *
 *  Created on: 2011/06/25
 *      Author: naoki
 */

#include "Stdafx.h"
#include "Graphics/src/IndexBufferImpl.h"

namespace NTEngine {
namespace Graphics {

IndexBuffer IndexBuffer::create( Xml::ConstElement e ){
	IndexBuffer r;
	r.mImpl = NEW Impl( e );
	return r;
}

IndexBuffer IndexBuffer::create( int indexNumber ) {
	IndexBuffer ret;
	ret.mImpl = NEW Impl( indexNumber );
	return ret;
}

void IndexBuffer::lock( unsigned short** pp ) {
	ASSERT( pp );
	*pp = mImpl->lock();
}

void IndexBuffer::unlock( unsigned short** pp ) {
	ASSERT( pp && *pp );
	mImpl->unlock();
	*pp = 0;
}

const char* IndexBuffer::name() const {
	return mImpl->mName;
}

int IndexBuffer::indexNumber() const {
	return mImpl->mIndexNumber;
}

IndexBuffer::IndexBuffer( const Impl* ) : mImpl( 0 ) { //ヌルポからの自動生成
}

#define TYPE IndexBuffer
#include "NTEngine/Base/Impl/ReferenceCounterTemplate.h"

} // namespace Graphics
} // namespace NtEngine
